#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>

#define FOR(i,a,n) for(int i=a,_n(n);i<_n;++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int a[100010];
int main()
{
    int n;
    while(cin>>n)
    {
        bool allOne = true;
        REP(i,n) scanf("%d",a+i);
        sort(a,a+n);
        REP(i,n) if(a[i]!=1)
        {
            allOne = false;
            break;
        }
        if(allOne)
        {
            REP(i,n-1) printf("1 ");
            printf("2");
        }
        else
        {
            printf("1");
            REP(i,n-1) printf(" %d",a[i]);
        }
        puts("");
    }
	return 0;
}
